import React from 'react';
import { connect } from 'dva'
import { routerRedux } from 'dva/router';
import { List, TextareaItem , ImagePicker , Button, WhiteSpace, WingBlank } from 'antd-mobile';
import { createForm } from 'rc-form';
import banner from '../img/p2_b.jpg';

const data = [{
  img:banner,
  id: '2121',
}];
class communication extends React.Component{
    state = {
      files: data,
    };

  onChange = (files, type, index) => {
    console.log(files, type, index);
    this.setState({
      files,
    });
  }

  render(){
    const { getFieldProps } = this.props.form;
    const { files } = this.state;
    console.log(files)
    return(
      <div>

        <WhiteSpace size='lg'/>
      <List >

        <TextareaItem
          {...getFieldProps('note1')}
          rows={8}
          placeholder="请在此处输入沟通的内容"
        />
      </List>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>
        <div style={{backgroundColor:'#FFFDFD',height:'2rem'}}>
          <ImagePicker
            files={files}
            onChange={this.onChange}
            onImageClick={(index, fs) => console.log(index, fs)}
            selectable={files.length < 5}
          />
        </div>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>
        <WhiteSpace size='lg'/>

        <Button type="submit" style={{width: '80%',marginLeft:'0.65rem',backgroundColor:'#DF3031',color:'#FFFDFD'}}>申请</Button>
      </div>
    )
  }
}
const communication11 = createForm()(communication);

function mapStateToProps({ work }){
  return {
    work
  };
}
export default connect(mapStateToProps)(communication11);
